// body参数用data设置
// Query参数用params设置
// Headers参数用headers设置

// 用户相关请求模块
import request from "@/utils/request.js";

//获取文章列表
export const getArticleList = params => {
  return request({
    method: 'GET',
    url: '/mp/v1_0/articles',
    params
  })
}

//获取文章频道
export const getArticleChannels = () => {
  return request({
    method: 'GET',
    url: '/mp/v1_0/channels',
  })
}

//删除文章
export const deleteArticle = (articleId) => {
  return request({
    method: 'DELETE',
    url: `/mp/v1_0//mp/v1_0/articles/${articleId}`,
  })
}

//  新建文章
export const creatArticle = (data, draft = false) => {
  return request({
    method: 'POST',
    url: '/mp/v1_0/articles',
    params: {
      draft //是否为草稿true为草稿
    },
    data
  })
}
